﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MigratorUI.Replayer.Commands;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace MigratorUI.Replayer
{
    public class ActionSaver
    {
        public ActionSaver(string fileName)
        {
            this.fileName = fileName;
        }

        public void SaveSimulation()
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream output = new FileStream(this.fileName, FileMode.OpenOrCreate, FileAccess.Write);
            formatter.Serialize(output, commands);
            output.Close();
        }

        public void AddCommand(Command command)
        {
            this.commands.Add(command);
        }

        private string fileName;
        private List<Command> commands = new List<Command>();
    }
}
